home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.3 Development Libraries / SGI IRIX 6.3 Development Libraries.iso / dist / dist6.3 / ViewKit_dev.idb / usr / include / Vk / VkMenu.h.z / VkMenu.h
C/C++ Source or Header  |  1996-09-20  |  6KB  |  164 lines

  1. ////////////////////////////////////////////////////////////////////////////////
  2. ///////   Copyright 1992, Silicon Graphics, Inc.  All Rights Reserved.   ///////
  3. //                                                                            //
  4. // This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;     //
  5. // the contents of this file may not be disclosed to third parties, copied    //
  6. // or duplicated in any form, in whole or in part, without the prior written  //
  7. // permission of Silicon Graphics, Inc.                                       //
  8. //                                                                            //
  9. // RESTRICTED RIGHTS LEGEND:                                                  //
  10. // Use,duplication or disclosure by the Government is subject to restrictions //
  11. // as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data     //
  12. // and Computer Software clause at DFARS 252.227-7013, and/or in similar or   //
  13. // successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -    //
  14. // rights reserved under the Copyright Laws of the United States.             //
  15. //                                                                            //
  16. ////////////////////////////////////////////////////////////////////////////////
  17.  
  18. #ifndef VKMENU_H
  19. #define VKMENU_H
  20.  
  21. #include <Vk/VkMenuItem.h>
  22. #include <Vk/VkSimpleWindow.h>
  23.  
  24. class VkWindow;
  25. class VkMenuAction;
  26. class VkMenuActionWidget;
  27. class VkMenuToggle;
  28. class VkSubMenu;
  29. class VkRadioSubMenu;
  30.  
  31. struct VkMenuDesc {
  32.     VkMenuItemType       menuType;
  33.     char        *name;    
  34.     XtCallbackProc       callback;
  35.     VkMenuDesc          *submenu;
  36.     XtPointer            clientData;
  37.     XtCallbackProc       undoCallback;
  38. };
  39.  
  40. class VkMenu : public VkMenuItem {
  41.  
  42.     friend   class VkMenuItem;
  43.     friend   class VkMenuBar;
  44.     friend   class VkSubMenu;
  45.  
  46.   public:
  47.  
  48.     virtual ~VkMenu();
  49.  
  50.     virtual void build(Widget);
  51.  
  52.     VkMenuAction       *addAction(const char     *name, 
  53.                   XtCallbackProc  func = NULL, 
  54.                   XtPointer       data      = NULL, 
  55.                   int             pos = -1);
  56.     VkMenuAction       *addAction(const char     *name,
  57.                   XtCallbackProc  func, 
  58.                   XtCallbackProc  undoCallback, 
  59.                   XtPointer       data, 
  60.                   int             pos  = -1);
  61.     VkMenuActionWidget *addActionWidget(const char     *name, 
  62.                     XtCallbackProc func = NULL, 
  63.                     XtPointer      data = NULL, 
  64.                     int            pos = -1);
  65.     VkMenuActionWidget *addActionWidget(const char      *name, 
  66.                     XtCallbackProc   func,
  67.                     XtCallbackProc   undoCallback, 
  68.                     XtPointer        data, 
  69.                     int              pos = -1);
  70.  
  71.     VkMenuConfirmFirstAction  *addConfirmFirstAction(const char     *name, 
  72.                              XtCallbackProc  func = NULL, 
  73.                              XtPointer       data = NULL, 
  74.                              int             pos = -1);
  75.  
  76.     VkMenuSeparator    *addSeparator(int pos = -1);
  77.     VkMenuSeparator    *addSeparator(const char *name, int pos = -1);    
  78.  
  79.     VkMenuLabel        *addLabel(const char *name, int pos = -1);
  80.  
  81.     VkMenuToggle       *addToggle(const char     *name, 
  82.                   XtCallbackProc  func = NULL, 
  83.                   XtPointer       data = NULL, 
  84.                   int             state = -1, 
  85.                   int             pos = -1);
  86.     VkMenuToggle       *addToggle(const char     *name, 
  87.                   XtCallbackProc  func, 
  88.                   XtCallbackProc  undoCallback, 
  89.                   XtPointer       data, 
  90.                   int             state = -1, 
  91.                   int             pos = -1);
  92.  
  93.     void                add(VkMenuItem *item, int pos = -1);
  94.  
  95.     VkSubMenu *addSubmenu(VkSubMenu *submenu, int pos = -1);
  96.     VkSubMenu *addSubmenu(const char *name, int pos = -1);
  97.     VkSubMenu *addSubmenu(const char *name, VkMenuDesc*, XtPointer defaultClientData = NULL, int pos = -1);
  98.  
  99.     VkRadioSubMenu *addRadioSubmenu(VkRadioSubMenu *submenu, int pos = -1);
  100.     VkRadioSubMenu *addRadioSubmenu(const char *name, int pos = -1);
  101.     VkRadioSubMenu *addRadioSubmenu(const char *name, VkMenuDesc*, XtPointer defaultClientData = NULL);
  102.  
  103.     // enter a submenu into the system, but don't show or attach it
  104.     // This allows it to be found using findNamedItem
  105.     
  106.     VkMenuItem *registerSubmenu(const char * name, XtCallbackProc func, XtPointer data, VkMenuItem * submenu);
  107.     
  108.     // manipulation of existing menu items, many more to be added
  109.  
  110.     VkMenuItem *findNamedItem(const char * , Boolean caseless = FALSE);
  111.  
  112.     VkMenuItem *removeItem(const char *);
  113.     VkMenuItem *activateItem(const char * );
  114.     VkMenuItem *deactivateItem(const char * );
  115.     VkMenuItem *replace(const char * , VkMenuItem * );
  116.  
  117.     static  void useWorkProcs(Boolean flag);
  118.     static  void useOverlayMenus(Boolean flag);
  119.  
  120.     virtual VkMenuItemType menuType () = 0;
  121.     virtual const char* className();
  122.     Boolean isContainer();
  123.     int getItemPosition(VkMenuItem*);
  124.     int getItemPosition(char *name);
  125.     int getItemPosition(Widget);
  126.     VkMenuItem * operator[] (int index) const;
  127.     int numItems() const;
  128.  
  129.   protected:
  130.  
  131.     VkMenuItem     **_contents;
  132.     int              _nItems;
  133.     int              _maxItems;
  134.  
  135.     VkMenu();
  136.     VkMenu(const char *name);
  137.     VkMenu(VkMenuDesc *, XtPointer defaultClientData=NULL);
  138.     VkMenu(const char *name, VkMenuDesc *, XtPointer defaultClientData=NULL);
  139.  
  140.     VkMenu *findParent(VkMenuItem *);
  141.     VkSimpleWindow *VkMenu::getWindow();
  142.     virtual Widget menuParent() = 0;
  143.  
  144.   private:
  145.  
  146.     static Boolean _useWorkProcs;
  147.     static Boolean _useOverlayMenus;
  148.     static Colormap _overlayColormap;
  149.     void handleMenuDescriptor(VkMenuDesc *, XtPointer);
  150.     void addMenuEntry(VkMenuItem *, int pos = -1);
  151.     int  removeMenuEntry(VkMenuItem *);
  152.  
  153.     
  154. };
  155.  
  156.  
  157.  
  158.  
  159. #endif
  160.  
  161.  
  162.  
  163.  
  164.